<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" placeholder="请输入添加图片的数量">
<input type="button" value="帅哥" onclick="f(1)">
<input type="button" value="美女" onclick="f(2)">
<hr>
<script>
  let i = document.querySelector("input");
  function f(x){
    for (let j = 0; j < i.value; j++) {
      let url = x == 1 ? "http://p0.itc.cn/q_70/images03/20221201/3a30afbc998943d5a378a8bac101fdb6.jpeg"
              : "https://w.wallhaven.cc/full/m9/wallhaven-m93yxk.jpg"
      let img = document.createElement("img");
      img.src = url;
      img.height = 300;
      document.body.append(img);
    }
  }

</script>
</body>
</html>